package com.atguigu.lease.sms;

import java.util.Random;

/**
 * @author Ahmad
 * @date 2024/12/26 14:57
 * @description
 */
public class CodeUtil {
    //生成验证码的方法
    public static String getCode(int length) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            //生成随机数
            int code = new Random().nextInt(10);
            sb.append(code);
        }
        return sb.toString();
    }
}